#if !defined(AFX_MATSETUP_H__9660730E_17D4_48B6_82B5_6754AB2903D6__INCLUDED_)
#define AFX_MATSETUP_H__9660730E_17D4_48B6_82B5_6754AB2903D6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MatSetup.h : header file
//
#include <afxtempl.h>
#include "resource.h"
#include "MyListBox.h"
#include "HexEdit.h"
typedef struct 
{
//	unsigned int type;              
	unsigned int size;                    
	CString content;   
	CString name;

} FLASH_ATTRIB_STRUCT;

typedef struct 
{
	unsigned int type;              
	unsigned int begin_pos;
	unsigned int end_pos;
	
	CString value;   
	CString name;

} MAT_ATTRIB_STRUCT;

/////////////////////////////////////////////////////////////////////////////
// CMatSetup dialog
class CMatSetup : public CDialog
{
// Construction
public:
	CMatSetup(CWnd* pParent = NULL);   // standard constructor

	CString m_strFile;
		
	void GetFlashFromIni();
	void SaveFlashToIni();
	void GetMatFromIni();
	void SaveMatToIni();

// Dialog Data
	//{{AFX_DATA(CMatSetup)
	enum { IDD = IDD_MAT_SETUP };
	CHexEdit	m_MatEndPosEdit;
	CHexEdit	m_MatBeginPosEdit;
	CHexEdit	m_MatValueEdit;
	CComboBox	m_MatValueCombo;
	CComboBox	m_MatType;
	CListBox	m_FlashList;
	CMyListBox	m_MatList;
	int		m_FlashIndex;
	CString	m_FlashName;
	UINT	m_FlashSize;
	CString	m_FlashFile;
	int m_CurList;
	CString	m_MatBeginPos;
	CString	m_MatEndPos;
	CString	m_MatName;
	CString	m_MatValue;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMatSetup)
	public:
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CMatSetup)
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnSelchangeListFlash();
	afx_msg void OnSelchangeListMat();
	afx_msg void OnSelchangeComboMatType();
	afx_msg void OnButtonSave();
	afx_msg void OnButtonDel();
	afx_msg void OnButtonFile();
	afx_msg void OnChangeEditFlashIndex();
	afx_msg void OnSelchangeComboMatValue();
	afx_msg void OnSetfocusListFlash();
	afx_msg void OnSetfocusListMat();
	afx_msg void OnButtonBuild();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	BOOL m_HasModified;
	CList<FLASH_ATTRIB_STRUCT,FLASH_ATTRIB_STRUCT> m_Flash;
	CList<MAT_ATTRIB_STRUCT,MAT_ATTRIB_STRUCT> m_Mat;

	void ShowFlashList();
	void FlashDel();
	void MatDel();
	void EnableFlashCtrl();

	void ShowMatList();
	void RefreshMatCombo();
	void EnableMatCtrl();
	void FlashSave();
	BOOL MatSave();
	void DisableFlashCtrl();
	void DisableMatCtrl();
	long ChangeStrToHex(CString* pstr  );

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif  // !defined(AFX_MATSETUP_H__9660730E_17D4_48B6_82B5_6754AB2903D6__INCLUDED_)
